package cn.iocoder.yudao.module.reading.enums.recommendation;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 推荐专区类型枚举
 *
 * @author 芋道源码
 */
@AllArgsConstructor
@Getter
public enum ZoneTypeEnum {

    FEATURED("featured", "精选推荐"),
    NEW("new", "新品上架"),
    POPULAR("popular", "热门推荐"),
    AGE("age", "年龄推荐"),
    THEME("theme", "主题推荐"),
    LEVEL("level", "难度推荐");

    /**
     * 类型代码
     */
    private final String code;
    /**
     * 类型名称
     */
    private final String name;

    public static ZoneTypeEnum fromCode(String code) {
        for (ZoneTypeEnum type : values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        return null;
    }

}
